package com.example.javaproject;

import java.util.Timer;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.app.TabActivity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.SeekBar;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class MainActivity extends TabActivity {//继承专门用于选项卡的活动

	TabHost tb;
	public static boolean isStop = true;
	public static MediaPlayer albumMp;
	public static String name;
	// 进度条
	public static SeekBar seekBar;
	public static Timer timer;
	public static boolean isSeekBarChanging;
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tb=(TabHost) findViewById(android.R.id.tabhost);//找到选项卡组件
        tb.setup();//初始化容器
        albumMp=new MediaPlayer();
        
        //歌曲的选项卡
        TabSpec songs=tb.newTabSpec("songs");
        songs.setIndicator("歌曲");
        Intent intent1=new Intent(MainActivity.this,Songs.class);
        songs.setContent(intent1);
        
        //歌手的选项卡
        TabSpec singer=tb.newTabSpec("singer");
        singer.setIndicator("歌手");
        Intent intent2=new Intent(MainActivity.this,Singer.class);
        singer.setContent(intent2);
        
        //专辑的选项卡
        TabSpec album=tb.newTabSpec("album");//创建一个选项卡说明对象
        album.setIndicator("专辑");//设置该选项卡按钮的显示文本
        Intent intent3=new Intent(MainActivity.this,Album.class);
        //通过intent说明当前选项卡显示的内容
        album.setContent(intent3);
        
        //列表选项卡
        TabSpec list=tb.newTabSpec("list");
        list.setIndicator("列表");
        Intent intent4=new Intent(MainActivity.this,List.class);
        list.setContent(intent4);
        
        //添加选项卡说明到TabHost
        tb.addTab(songs);
        tb.addTab(singer);
        tb.addTab(album);
        tb.addTab(list);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}
